<% 
	var headContent = {
	include("/pages/template/head.html"){}
%>

<script type="text/javascript">
var oper;
jQuery(function($) {
	// 页面方法
	oper = {
		width : 450,
		height : 500,
		form : document.form1,
		list : function() {
			var url = 'user/list';
			this.form.action = url;
			this.form.submit();
		},
		view : function(id) {
			var url = 'user/view/'+id;
			var title = '查看用户';
			Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
		},
		add : function() {
			var url = 'user/add';
			var title = '添加用户';
			Iframe(url, this.width, this.height, title);
		},
		edit : function(id) {
			var url = 'user/edit/'+id;
			var title = '修改用户';
			Iframe(url, this.width, this.height, title);
		},
		del : function(id) {
			var url = 'user/delete/'+id;
			var title = '确认要删除该用户信息？';
			Confirm(title, function() {
				form1.action = url;
				form1.submit();
			});
		}
		,auth : function(id) {
			var url = 'user/auth/'+id;
			var title = '授权角色';
			Iframe(url, 320, 400, title);
		}
	};
	//显示Menu索引
	showMenu('page_system');
	showMenu('page_user');
});

//分页
var paginator = function(page) {
	oper.list();
};

</script>

<%
};

var bodyContent = {
%>
	<form name="form1" action="" method="post"  class="form-inline" role="form">
		<!-- 菜单 -->
		<% include("/static/component/include/menu.html"){} %>

		<div class="tableSearch">
			<%  //查询列表 %>
			<div class="form-group">
					<input class="form-control" type="text" name="attr.username" value="${attr.username!''}" 
						placeholder="请输入登陆名" required='required' />
			</div>
				<div class="form-group">
					<input class="form-control" type="text" name="attr.realname" value="${attr.realname!''}" 
						placeholder="请输入真实姓名"  />
			</div>
				<div class="form-group">
				<select name="attr.usertype" class="form-control" >
					<option value="-1">--请选择--</option>
					<option value="1" ${attr.usertype==1?"selected":"" }>管理员</option>
					<option value="2" ${attr.usertype==2?"selected":"" }>普通用户</option>
					<option value="3" ${attr.usertype==3?"selected":"" }>前台用户</option>
					<option value="4" ${attr.usertype==4?"selected":"" }>第三方用户</option>
					<option value="9" ${attr.usertype==9?"selected":"" }>其他用户</option>
				</select>
				
				
			</div>
			<div class="form-group">
				<select name="attr.departid" class="form-control"   >
						<option value="-1" >--请选择部门--</option>
						${departSelect}
				</select>
			</div>
	 
			
			<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
			 		<span class="glyphicon glyphicon-search"></span> 查 询
			</button>
			<button type="button" class="btn btn-default" onclick="resetForm();">
			 		<span class="glyphicon glyphicon-refresh"></span> 重 置
			</button>
			<button type="button" class="btn btn-default" onclick="oper.add();">
			 		<span class="glyphicon glyphicon-plus"></span> 新 增
			</button>
		</div>
		
		<!-- 数据列表 -->
		<table class="table table-striped table-bordered table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<%  // 列表头部 %>
					<th>部门</th> 
					<th>登陆名</th> 
					<th>真实姓名</th> 
					<th>状态</th> 
					<th>Email</th> 
					<th>手机号</th> 
 
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
			<% for(item in page.list){ %>
				<tr>
					<td>${itemLP.index }</td>
					<%  // 列表内容 %>
					<td>${item.departname}</td> 
					<td>${item.username}</td> 
					<td>${item.realname}</td> 
					<% var usertype_data = '[{"key":"1","value":"管理员"},{"key":"2","value":"普通用户"},{"key":"3","value":"前台用户"},{"key":"4","value":"第三方用户"},{"key":"9","value":"其他用户"}]'; %>
					<td>${flyfox.selValue(usertype_data,item.usertype!'')  }
					</td>
					<td>${item.email}</td> 
					<td>${item.tel}</td> 
	 
					<td>
					<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${item.userid});">查看</a> 
					<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${item.userid});">修改</a> 
					<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${item.userid});">删除</a>
					<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.auth(${item.userid});">授权</a>
					</td>
				</tr>
			<% } %>
			</tbody>
		</table>
		<%include("/static/component/include/paginator.html"){} %>
	</form>
<%}; %>


<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>